﻿using System;
using System.Collections.Generic;
using System.Linq;
using LtccApi.Models;
using Microsoft.AspNetCore.Mvc;

namespace LtccApi.Controllers
{
    /// <summary>
    /// 汽车轮胎型号
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class CarTireSizeController : Controller
    {
        private LtccContext mLtccContext;
        /// <summary>
        /// Initializes a new instance of the <see cref="T:LtccApi.Controllers.CarTireController"/> class.
        /// </summary>
        /// <param name="ltccContext">Ltcc context.</param>
        public CarTireSizeController(LtccContext ltccContext)
        {
            mLtccContext = ltccContext;
        }

        /// <summary>
        /// 轿车轮胎型号
        /// </summary>
        /// <param name="carName"></param>
        /// <returns></returns>
        [HttpGet("{carName}")]
        public IActionResult List(string carName)
        {
            List<CarTireSize> carTypes = mLtccContext.CarTireSizes.Where(m => m.CarName == carName).ToList();
            return Ok(carTypes);
        }
    }
}
